home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / bbs_util / bsrc_260.zip / INCLUDE.ZIP / SBUF.H < prev    next >
C/C++ Source or Header  |  1996-02-21  |  7KB  |  180 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*              (C) Copyright 1987-96, Bit Bucket Software Co.              */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                                                                          */
  14. /*              Screen Buffer Definitions used in BinkleyTerm               */
  15. /*                                                                          */
  16. /*                                                                          */
  17. /*    For complete  details  of the licensing restrictions, please refer    */
  18. /*    to the License  agreement,  which  is published in its entirety in    */
  19. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.260.    */
  20. /*                                                                          */
  21. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  22. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  23. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  24. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  25. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  26. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  27. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  28. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  29. /*                                                                          */
  30. /*                                                                          */
  31. /* You can contact Bit Bucket Software Co. at any one of the following      */
  32. /* addresses:                                                               */
  33. /*                                                                          */
  34. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  35. /* P.O. Box 460398                AlterNet 7:42/1491                        */
  36. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  37. /*                                Internet f491.n343.z1.fidonet.org         */
  38. /*                                                                          */
  39. /* Please feel free to contact us at any time to share your comments about  */
  40. /* our software and/or licensing policies.                                  */
  41. /*                                                                          */
  42. /*--------------------------------------------------------------------------*/
  43.  
  44. #define SB_OK    0
  45. #define SB_ERR    (-1)
  46.  
  47. #define SB_MODE_ANSI    1
  48. #define SB_MODE_AVATAR    2
  49. #define SB_MODE_SIMPLE    0
  50.  
  51. /* screen buffer constants */
  52.  
  53. extern short SB_ROWS;
  54. extern short SB_COLS;
  55.  
  56. #define SB_SIZ    (SB_ROWS * SB_COLS)
  57.  
  58. #define SB_NXTLINE(w,p) \
  59.         (((p) + (w)->linesize >= (w)->endbuff) ? (w)->buffer : (p) + (w)->linesize)
  60.  
  61. typedef struct
  62. {
  63.     unsigned short Attr;        /* Note, this is NOT the same as a */
  64.                                 /* Windows attr word               */
  65.     short Bgd;
  66.     unsigned char Buf[81];
  67.     short CtrlSeqIntro;
  68.     short Esc;
  69.     short Fgd;
  70.     short NewLineKludge;
  71.     short Mode;                    /* Simple, ANSI, or Avatar */
  72.     unsigned short SaveCol;
  73.     unsigned short SaveRow;
  74.     short Scroll;
  75.     short State;                /* Maybe run it like an FSM */
  76. } _ANSIStuff, *_ANSIStuffP;
  77.  
  78. /* screen character/attribute buffer element definition */
  79.  
  80. typedef struct
  81. {
  82.     unsigned char ch;            /* character */
  83.     unsigned char attr;            /* attribute */
  84. } BYTEBUF, *BYTEBUFP;
  85.  
  86. typedef union
  87. {
  88.     BYTEBUF b;
  89.     unsigned short cap;            /* character/attribute pair */
  90. } CELL, *CELLP;
  91.  
  92. /* screen buffer control structure */
  93.  
  94. typedef struct
  95. {
  96.     short row, col;                /* current position */
  97.     CELLP bp;                    /* pointer to screen buffer array */
  98.  
  99.     /* changed region per screen buffer row */
  100.  
  101.     short *lcol;                /* left end of changed region */
  102.     short *rcol;                /* right end of changed region */
  103.  
  104.     unsigned int flags;            /* buffer status */
  105. } BUFFER, *BUFFERP;
  106.  
  107. /* buffer flags values */
  108.  
  109. #define SB_DELTA    0x01
  110. #define SB_RAW        0x02
  111. #define SB_DIRECT    0x04
  112. #define SB_SCROLL    0x08
  113. #define SB_SYNC        0x10
  114.  
  115. /* coordinates of a window (rectangular region) on the screen buffer */
  116.  
  117. /* At one point, we tried substituting REGION with HWND.  There were some
  118.  * inherent problems with this, most notably, that a window doesn't have
  119.  * a current cursor position concept.
  120.  *
  121.  * We probably can and should create a special window class that would
  122.  * deal with this, but not today...
  123.  */
  124.  
  125. typedef struct
  126. {
  127.     short row, col;                /* current position */
  128.  
  129.                                 /* window boundaries */
  130.     short r0, c0;                /* upper left corner */
  131.     short r1, c1;                /* lower right corner */
  132.  
  133.                                 /* scrolling region boundaries */
  134.     short sr0, sc0;                /* upper left corner */
  135.     short sr1, sc1;                /* lower right corner */
  136.  
  137.     unsigned short wflags;        /* window buffer flags */
  138.  
  139.     short linesize;                /* line size */
  140.     short lines;                /* number of scrollable lines */
  141.     char *buffer;                /* scroll buffer */
  142.     char *endbuff;                /* end of buffer */
  143.     char *lastline;                /* -> last line */
  144.     char *lastshown;            /* -> last line displayed */
  145.  
  146.     _ANSIStuff ANSI;
  147. } REGION, *REGIONP;
  148.  
  149. /* coordinates of a window (rectangular region) on the screen buffer */
  150. typedef struct
  151. {
  152.     short save_row, save_col;    /* top left corner */
  153.     short save_ht, save_wid;    /* height and width */
  154.  
  155.     REGIONP region;                /* Window to use */
  156.  
  157.     CELLP save_cells;            /* Saved cells from the window */
  158.  
  159. } BINK_SAVE, *BINK_SAVEP;
  160.  
  161. #define HIST_BBS_ROW    1
  162. #define HIST_MAIL_ROW    1
  163. #define HIST_ATT_ROW    2
  164. #define HIST_CONN_ROW    3
  165. #define HIST_FILE_ROW    4
  166. #define HIST_LAST_ROW    5
  167. #define HIST_COL        13
  168. #define HIST_COL2        8
  169.  
  170. #define SET_EVNT_ROW    2
  171. #define SET_PORT_ROW    3
  172. #define SET_TIME_ROW    1
  173. #define SET_DATE_ROW    4
  174. #define SET_STAT_ROW    4
  175. #define SET_TASK_ROW    5
  176.  
  177. #define SET_COL            10
  178. #define SET_TIME_COL    2
  179.  
  180.